home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / 1997.ZIP / WINDO26.ARC / WINTUTOR.PAS < prev   
Pascal/Delphi Source File  |  1987-09-21  |  10KB  |  259 lines

  1. program WinTutor(input,output);
  2. {$Iwindo.inc}
  3.  
  4. type str80 = string[80];
  5. var i: integer;
  6.     a: string[127];
  7.     j,k: byte;
  8. const
  9.     stra : array [1..13] of str80 = (
  10.       '',
  11.       'The   windowing  procedures  in   the   file',
  12.       'WINDO.INC   are  a  set  of  public   domain',
  13.       'routines  that allow  Turbo PASCAL to create',
  14.       'and use windows.   The windows may be of any',
  15.       'size (from 2 X 2 to 80 X 25)  and color, and',
  16.       'may  have  one  of several different  border',
  17.       'styles, including  no border.  Once inside a',
  18.       'window,  the normal  Turbo PASCAL procedures',
  19.       '"textcolor" and "textbackground" may be used',
  20.       'to change character attributes.  The  window',
  21.       'routines automatically determine whether you',
  22.       'are using a color or monochrome display.');
  23.  
  24.     strb : array [1..14] of str80 = (
  25.       '',
  26.       'The window procedures package consists of four  procedures;',
  27.       '"Initwindo", "Makewindo",  "Removewindo" and  "Titlewindo".',
  28.       'The procedures are described in the following windows:',
  29.       'INITWINDO',
  30.       '',
  31.       'FORMAT:   INITWINDO (textcolor,textbackground : integer);',
  32.       '',
  33.       'Initwindo  initializes  several variables required  by  the',
  34.       'windowing package,  as well as selecting the foreground and',
  35.       'background colors of the initial screen display.  Initwindo',
  36.       'must be called before using either of the other procedures.',
  37.       'After using Initwindo, normal action is to clear the screen',
  38.       'with clrscr.');
  39.  
  40.     strc : array [1..16] of str80 = (
  41.       'MAKEWINDO',
  42.       '',
  43.       'FORMAT:  MAKEWINDO (X1,Y1,X2,Y2,txtcolor,txtbkgnd,border,shadow : integer);',
  44.       '',
  45.       'Makewindo puts a new blank window on the display.  The window starts at the',
  46.       'upper  left corner (X1,Y1)  and ends at the lower right corner (X2,Y2).  If',
  47.       'a border exists,  the actual dimensions  of the window  will be 2 less than',
  48.       'indicated in the Makewindo statement. The border can be  one of the follow-',
  49.       'ing:',
  50.       '',
  51.       '   singleb  - single border           doubleb  - double border',
  52.       '   solidb   - solid border            noneb    - no border',
  53.       '   mixedb   - single sides, double top border',
  54.       '   dimondb  - diamond border          circleb  - circles border',
  55.       '   lhatchb  - light hatch border      mhatchb  - medium hatch border',
  56.       '   dhatchb  - dense hatch border');
  57.  
  58.    strca : array [1..7] of str80 = (
  59.       'Makewindo  can also  put a shadow on the  screen when',
  60.       'creating a window.  This is the purpose of the shadow',
  61.       'variable.  It may have the following values:',
  62.       '',
  63.       '   lefts - put a shadow on the left side of a window',
  64.       '   rights- put a shadow on the right side of a window',
  65.       '   nones - don''t put any shadow up.');
  66.  
  67.     strd : array [1..6] of str80 = (
  68.       'REMOVEWINDO',
  69.       'FORMAT:  REMOVEWINDO;',
  70.       '',
  71.       'Removewindo removes  the last window',
  72.       'that was placed on the screen by the',
  73.       'Makewindo procedure.');
  74.  
  75.     stre : array [1..8] of str80 = (
  76.       'TITLEWINDO',
  77.       'FORMAT:  TITLEWINDO (title: string[80]; placed,attributes: byte);',
  78.       '',
  79.       'Titlewindo places a title wherever you specify by the ''placed''',
  80.       'variable, using the given attributes.  ''Placed'' may be one of:',
  81.       '  leftt - Left top     rightt - Right top     centert - Center top',
  82.       '  leftb - Left bottom  rightb - Right bottom  centerb - Center bottom',
  83.       'Using titlewindo is strictly optional.');
  84.  
  85.     strf : array [1..6] of str80 = (
  86.       '',
  87.       ' The maximum  number  of windows that',
  88.       ' may be on the screen at any one time',
  89.       ' is   specified   by   the   variable',
  90.       ' "maxwin".  Maxwin  is  currently  30',
  91.       ' and is limited to a maximum of 255.');
  92.  
  93.     stri : array [1..14] of str80 = (
  94.       '',
  95.       ' There are five utility procedures that may be',
  96.       ' of use:',
  97.       '',
  98.       ' Bleep(number_of_bleeps : byte);',
  99.       ' ErrorSound;',
  100.       ' Set_cursor(Cursor_Size : byte);',
  101.       ' DispLine(colb,rowb,attrib : byte, str : str80);',
  102.       ' Wattr(text,backgnd: byte) : byte;',
  103.       '',
  104.       ' colb and rowb is relative to the entire screen.',
  105.       ' attrib := Wattr(textcolor,backgroundcolor);',
  106.       ' str is a string of length 80.',
  107.       ' backgroundcolor should be less than 8.');
  108.  
  109.     strg : array [1..18] of str80 = (
  110.       ' The procedures are used as follows:',
  111.       '',
  112.       '  Program xxx(Input,Output);',
  113.       '  {$IWindo.Inc}',
  114.       '  ...your variables and procedures...',
  115.       '  Begin',
  116.       '    .',
  117.       '    Initwindo(textcolor,textbackground);',
  118.       '    ClrScr;',
  119.       '    .',
  120.       '    Makewindo(begcol,begrow,endcol,endrow,txtcol,txtbkgnd,brdr,shadow);',
  121.       '    Titlewindo(''This is the window title'',placed,attributes);',
  122.       '    .',
  123.       '    Removewindo;',
  124.       '    .',
  125.       '  End.',
  126.       '',
  127.       ' Use one removewindo for each makewindo.');
  128.  
  129.     strh : array [1..7] of str80 = (
  130.       'If you have any questions or comments,',
  131.       'please write to or call:',
  132.       '',
  133.       '   Michael Burton',
  134.       '   15540 Boot Hill Rd.',
  135.       '   Hayden Lake, ID 83835',
  136.       '   (208)772-9347 (after 1800 PST)');
  137.  
  138. begin
  139.    set_cursor(0);                   { Turn off the cursor            }
  140.    initwindo(blue,cyan);            { Initialize the window routines }
  141.    clrscr;
  142.    For i := 1 to 30 do              { Put up 30 random windows       }
  143.    begin
  144.       j := random(69);
  145.       k := random(20);
  146.       makewindo(j+1,k+1,j+11,k+5,yellow,red,lhatchb,rights);
  147.       gotoxy(2,2);
  148.       Write('WINDOWS');
  149.    end;
  150.    delay(3000);
  151.    for i := 1 to 30 do removewindo; { Erase the 30 random windows    }
  152.  
  153.    gotoxy(25,1);
  154.    writeln('Turbo PASCAL Windows Tutorial');
  155.    textcolor(black);
  156.    gotoxy(14,12);
  157.    writeln('This is the original screen. It is not a window.');
  158.    Delay(2000);
  159.  
  160.    { Put the opening blurb in the first window. }
  161.    makewindo(3,3,49,18,black,green,mixedb,nones);
  162.    titlewindo(' Turbo PASCAL Windows ',centert,Wattr(black,green));
  163.    titlewindo(' Enter to Continue ',centerb,Wattr(yellow,green));
  164.    For j :=1 to 13 do DispLine(3,j+2,Wattr(black,green),stra[j]);
  165.    readln;
  166.  
  167.    { Put the initwindo explanation in the second window }
  168.    makewindo(1,5,61,23,yellow,red,singleb,nones);
  169.    titlewindo(' Turbo PASCAL Windows (Continued) ',centert,Wattr(yellow,red));
  170.    titlewindo(' Enter to Continue ',centerb,Wattr(white,red));
  171.    For j :=1 to 4 do DispLine(1,j+4,Wattr(yellow,red),strb[j]);
  172.    DispLine(4,10,Wattr(white,blue),strb[5]);
  173.    For j :=6 to 8 do DispLine(1,j+5,Wattr(cyan,red),strb[j]);
  174.    For j :=9 to 14 do DispLine(1,j+5,Wattr(white,red),strb[j]);
  175.    readln;
  176.  
  177.    { Put the makewindo explanation in the third window }
  178.    makewindo(2,4,80,24,lightmagenta,blue,solidb,nones);
  179.    titlewindo(' Turbo PASCAL Windows (Continued) ',centert,Wattr(lightmagenta,blue));
  180.    titlewindo(' Enter to Continue ',centerb,Wattr(white,blue));
  181.    DispLine(7,5,Wattr(yellow,red),strc[1]);
  182.    For j :=2 to 4 do DispLine(3,j+5,Wattr(lightred,blue),strc[j]);
  183.    For j :=5 to 16 do DispLine(3,j+5,Wattr(yellow,blue),strc[j]);
  184.    readln;
  185.  
  186.    { More of the makewindo explanation in the fourth window }
  187.    makewindo(12,6,68,16,black,lightgray,mixedb,rights);
  188.    titlewindo(' Turbo PASCAL Windows (Continued) ',centert,Wattr(black,lightgray));
  189.    titlewindo(' Enter to Continue ',centerb,Wattr(yellow,lightgray));
  190.    For j :=1 to 7 do DispLine(13,j+6,Wattr(black,lightgray),strca[j]);
  191.    readln;
  192.  
  193.    { Put the removewindo explanation in the fifth window }
  194.    makewindo(13,10,51,21,black,brown,doubleb,nones);
  195.    titlewindo(' Turbo PASCAL Windows (Continued) ',centert,Wattr(black,brown));
  196.    titlewindo(' Enter to Continue ',centerb,Wattr(yellow,brown));
  197.    DispLine(17,11,Wattr(white,magenta),strd[1]);
  198.    DispLine(13,13,Wattr(yellow,brown),strd[2]);
  199.    For j :=3 to 6 do DispLine(13,j+11,Wattr(white,brown),strd[j]);
  200.    readln;
  201.  
  202.    { Put the titlewindo explanation in the sixth window }
  203.    makewindo(3,10,75,23,red,lightgray,dimondb,nones);
  204.    titlewindo(' Turbo PASCAL Windows (Continued) ',centert,Wattr(lightgray,red));
  205.    titlewindo(' Enter to Continue ',centerb,Wattr(yellow,red));
  206.    DispLine(8,12,Wattr(lightgreen,blue),stre[1]);
  207.    DispLine(4,14,Wattr(black,lightgray),stre[2]);
  208.    For j :=3 to 8 do DispLine(4,j+12,Wattr(red,lightgray),stre[j]);
  209.    readln;
  210.  
  211.    { Put maxwin explanation in the seventh window }
  212.    makewindo(12,16,49,22,black,brown,noneb,lefts);
  213.    Titlewindo(' Enter to Continue ',centerb,Wattr(yellow,brown));
  214.    For j :=1 to 6 do DispLine(11,j+14,Wattr(black,brown),strf[j]);
  215.    readln;
  216.  
  217.    { Put the utilities explanation in the eighth window }
  218.    makewindo(20,7,70,23,yellow,red,circleb,nones);
  219.    titlewindo(' Utility Procedures ',centert,Wattr(yellow,red));
  220.    titlewindo(' Enter to Continue ',centerb,Wattr(yellow,red));
  221.    For j :=1 to 14 do DispLine(20,j+6,Wattr(white,red),stri[j]);
  222.    readln;
  223.  
  224.    { Put the using the routines explanation in the ninth window }
  225.    makewindo(3,3,78,24,black,magenta,mhatchb,nones);
  226.    titlewindo(' Using The Routines ',centert,Wattr(yellow,magenta));
  227.    titlewindo(' Enter to Continue ',centerb,Wattr(white,magenta));
  228.    For j :=1 to 18 do DispLine(4,j+3,Wattr(black,magenta),strg[j]);
  229.    readln;
  230.  
  231.    { Put the advertising in the tenth window }
  232.    makewindo(20,8,60,17,black,brown,dhatchb,nones);
  233.    titlewindo(' Enter to Exit ',centerb,Wattr(yellow,brown));
  234.    For j :=1 to 7 do DispLine(21,j+8,Wattr(white,brown),strh[j]);
  235.    readln;
  236.  
  237.    removewindo;   { Now get rid of all the windows }
  238.    removewindo;
  239.    removewindo;
  240.    removewindo;
  241.    removewindo;
  242.    removewindo;
  243.    removewindo;
  244.    removewindo;
  245.    removewindo;
  246.    removewindo;
  247.    gotoxy(1,2);
  248.    clreol;
  249.    gotoxy(1,12);
  250.    clreol;
  251.    gotoxy(21,12);
  252.    writeln('This concludes the windows tutorial...');
  253.    delay(2000);
  254.    set_cursor(2);
  255.    textcolor(white);
  256.    textbackground(black);
  257.    clrscr;
  258. end.
  259.